class Friends_management:
    friend_list = []
    def __init__(self):
        print('**好友管理系统**')
        print('1:添加好友')
        print('2:删除好友')
        print('3:备注好友')
        print('4:展示好友')
        print('5:好有分组')
        print('6:退出')
    def friend_add(self):
        while True:
            print('退出请输入数字0')
            name = input('请输入要添加的好友姓名:\n')
            if name.isnumeric() == False and name not in self.friend_list:
                self.friend_list.append(name)
                print(self.friend_list)
            elif name.isnumeric() == False and name in self.friend_list:
                print('该好友已存在')
            elif name.isnumeric() == True and name == '0':
                print('添加好友功能已退出')
                break
        return self.friend_list
    def friend_deldte(self):
        while True:
            print('输入数字0退出删除好友功能')
            name = input('请输入想要删除的好友姓名')
            if name.isnumeric() == False and name  in self.friend_list:
                self.friend_list.remove(name)
            elif name.isnumeric() == False and name not in self.friend_list:
                print(f'要删除的好友名{name}不存在')
            elif name.isnumeric() == True and name == '0':
                break
        return self.friend_list
    def friend_modify(self):
        while True:
            print('输入数字0退出修改功能')
            name = input('请输入需要修改的旧名字:')
            if name.isnumeric() == False and name in self.friend_list:
                self.friend_list.remove(name)
                new_name = input('请输入修改后的名字:')
                self.friend_list.append(new_name)
            elif name.isnumeric() == False and name not in self.friend_list:
                print('旧名字不存在:')
            elif name.isnumeric() == True and name == '0':
                break
        return self.friend_list
    def show_all(self):
        for name in self.friend_list:
            print(name+'\n')
    def grouping(self):
        print('')















friend_management = Friends_management()
friend_management.friend_add()
